﻿<Window x:Class="WF.VecDraw.Dialog.ColorDialog"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="" Height="192" Width="380" ResizeMode="NoResize" ShowInTaskbar="False" WindowStyle="None" BorderBrush="Black" BorderThickness="1" Background="LightGray" Loaded="Window_Loaded" KeyUp="Window_KeyUp">
    <!--Height="250" Width="404"-->
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="160"/>
            <RowDefinition Height="30"/>
        </Grid.RowDefinitions>

        <Grid Grid.Row="0" VerticalAlignment="Top">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="50"/>
                <ColumnDefinition Width="170"/>
                <ColumnDefinition Width="120"/>
                <ColumnDefinition Width="40"/>
            </Grid.ColumnDefinitions>
            
            <Rectangle Grid.Column="0" Height="40" Width="40" Name="selectedColorDisplay" Stroke="Black" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="2" />
            
            <Image Grid.Column="1" x:Name="ColorImage" Width="150" Height="150" 
                       HorizontalAlignment="Center"
                       VerticalAlignment="Top" Margin="2"
                       Source="../Images/ColorSwatchSquare.png"/>
            <Canvas Grid.Column="1" x:Name="ColorPalete" Width="150" Height="150" 
                       HorizontalAlignment="Center"
                       Background="Transparent"
                       VerticalAlignment="Top" Margin="2"
                       MouseUp="ColorPalete_MouseUp">
                <Ellipse x:Name="ellipsePixel" Width="5" 
                       Height="5" Stroke="Black" Fill="White" 
                       Canvas.Left="0" Canvas.Top="0"/>
            </Canvas>


            <Line Grid.Column="2" Stroke="Black" StrokeThickness="1" X1="40" Y1="85" X2="170"  Y2="85"/>
            <Line Grid.Column="2" Stroke="Black" StrokeThickness="1" X1="30" Y1="9" X2="170"  Y2="9"/>
            <Line Grid.Column="3" Stroke="Black" StrokeThickness="1" X1="0" Y1="85" X2="30"  Y2="85"/>
            <Line Grid.Column="3" Stroke="Black" StrokeThickness="1" X1="0" Y1="9" X2="30"  Y2="9"/>

            <StackPanel Orientation="Vertical" Grid.Column="2">
                <Label Height="19" HorizontalAlignment="Left" Width="30" VerticalContentAlignment="Center" Margin="0,0,0,0" Padding="5,0,0,0">RGB</Label>
                <Label Height="19" HorizontalAlignment="Left" Width="20" VerticalContentAlignment="Center" Padding="5,0,0,0">R</Label>
                <Label Height="19" HorizontalAlignment="Left" Width="20" VerticalContentAlignment="Center" Padding="5,0,0,0">G</Label>
                <Label Height="19" HorizontalAlignment="Left" Width="20" VerticalContentAlignment="Center" Padding="5,0,0,0">B</Label>
                <Label Height="19" HorizontalAlignment="Left" Width="40" VerticalContentAlignment="Center" Padding="5,0,0,0">Alpha</Label>
                <Label Height="19" HorizontalAlignment="Left" Width="20" VerticalContentAlignment="Center" Padding="5,0,0,0">A</Label>
            </StackPanel>

            <StackPanel Orientation="Vertical" Grid.Column="2">
                <Border  x:Name="rBorder"
                    BorderBrush="Black" BorderThickness="1" CornerRadius="2" Height="10" Margin="20,24,5,0">
                    <Slider x:Name="rColorSlider" Orientation="Horizontal"
                        Minimum="0" Maximum="255" 
                        SmallChange="1" LargeChange="25"
                        Margin="1" 
                        VerticalAlignment="Center"
                        Value="255"
                        ValueChanged="rColorSlider_ValueChanged"/>
                </Border>

                <Border x:Name="gBorder"
                    BorderBrush="Black" BorderThickness="1" CornerRadius="2" Height="10" Margin="20,9,5,0">
                    <Slider x:Name="gColorSlider" Orientation="Horizontal"
                        Minimum="0" Maximum="255" 
                        SmallChange="1" LargeChange="25"
                        Margin="1" 
                        VerticalAlignment="Center"
                        Value="255"
                        ValueChanged="gColorSlider_ValueChanged" AutoToolTipPlacement="None" />
                </Border>

                <Border x:Name="bBorder"
                    BorderBrush="Black" BorderThickness="1" CornerRadius="2" Height="10" Margin="20,9,5,0">
                    <Slider x:Name="bColorSlider" Orientation="Horizontal"
                        Minimum="0" Maximum="255" 
                        SmallChange="1" LargeChange="25"
                        Margin="1" 
                        VerticalAlignment="Center"
                        Value="255"
                        ValueChanged="bColorSlider_ValueChanged"/>
                </Border>

                <Border x:Name="AlphaBorder"
                    BorderBrush="Black" BorderThickness="1" CornerRadius="2" Height="10" Margin="20,27,5,0">
                    <Slider x:Name="AlphaSlider" Orientation="Horizontal"
                        Minimum="0" Maximum="255" 
                        SmallChange="1" LargeChange="25"
                        Margin="1" 
                        VerticalAlignment="Center"
                        Value="255"
                        ValueChanged="AlphaSlider_ValueChanged" VerticalContentAlignment="Top" />
                </Border>

            </StackPanel>

            <StackPanel Orientation="Vertical" Grid.Column="3">
                <TextBox Name="txtColorR" Height="18" Margin="5,20,5,0" FontSize="11" TextChanged="txtColor_TextChanged"></TextBox>
                <TextBox Name="txtColorG" Height="18" Margin="5,1,5,0" FontSize="11" TextChanged="txtColor_TextChanged"></TextBox>
                <TextBox Name="txtColorB" Height="18" Margin="5,1,5,0" FontSize="11" TextChanged="txtColor_TextChanged"></TextBox>
                <TextBox Name="txtColorA" Height="18" Margin="5,19,5,0" FontSize="11" TextChanged="txtColor_TextChanged"></TextBox>
            </StackPanel>
            
        </Grid>
        <Grid Grid.Row="1">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="50"/>
                <ColumnDefinition Width="170"/>
                <ColumnDefinition Width="120"/>
                <ColumnDefinition Width="40"/>
            </Grid.ColumnDefinitions>
        
            <Line Grid.Column="1" Stroke="Black" StrokeThickness="1" X1="0" Y1="0" X2="170"  Y2="0"/>
            <Line Grid.Column="2" Stroke="Black" StrokeThickness="1" X1="0" Y1="0" X2="170"  Y2="0"/>
            
            <StackPanel Orientation="Horizontal" Grid.Column="1" Margin="0,6,0,0">
                <Border Name="transparentBorder" HorizontalAlignment="Left" VerticalAlignment="Top" BorderBrush="Black" BorderThickness="1" Height="12" Width="12">
                    <Image Source="../Images/Symbol_Transparen.png" MouseEnter="Transparent_MouseEnter" MouseLeave="Transparent_MouseLeave" MouseLeftButtonUp="Transparent_MouseLeftButtonUp" />
                </Border>
                <Rectangle HorizontalAlignment="Left" VerticalAlignment="Top" Width="12" Height="12" Fill="Black" MouseEnter="ColorRect_MouseEnter" MouseLeave="ColorRect_MouseLeave" MouseLeftButtonUp="ColorRect_MouseLeftButtonUp" />
                <Rectangle HorizontalAlignment="Left" VerticalAlignment="Top" Width="12" Height="12" Fill="Gray" MouseEnter="ColorRect_MouseEnter" MouseLeave="ColorRect_MouseLeave" MouseLeftButtonUp="ColorRect_MouseLeftButtonUp" />
                <Rectangle HorizontalAlignment="Left" VerticalAlignment="Top" Width="12" Height="12" Fill="LightGray" MouseEnter="ColorRect_MouseEnter" MouseLeave="ColorRect_MouseLeave" MouseLeftButtonUp="ColorRect_MouseLeftButtonUp"/>
                <Rectangle HorizontalAlignment="Left" VerticalAlignment="Top" Width="12" Height="12" Fill="Red" MouseEnter="ColorRect_MouseEnter" MouseLeave="ColorRect_MouseLeave" MouseLeftButtonUp="ColorRect_MouseLeftButtonUp"/>
                <Rectangle HorizontalAlignment="Left" VerticalAlignment="Top" Width="12" Height="12" Fill="Green" MouseEnter="ColorRect_MouseEnter" MouseLeave="ColorRect_MouseLeave" MouseLeftButtonUp="ColorRect_MouseLeftButtonUp"/>
                <Rectangle HorizontalAlignment="Left" VerticalAlignment="Top" Width="12" Height="12" Fill="Yellow" MouseEnter="ColorRect_MouseEnter" MouseLeave="ColorRect_MouseLeave" MouseLeftButtonUp="ColorRect_MouseLeftButtonUp"/>
                <Rectangle HorizontalAlignment="Left" VerticalAlignment="Top" Width="12" Height="12" Fill="Black" MouseEnter="ColorRect_MouseEnter" MouseLeave="ColorRect_MouseLeave" MouseLeftButtonUp="ColorRect_MouseLeftButtonUp"/>
            </StackPanel>
            <StackPanel Orientation="Horizontal" Grid.Column="1" Margin="0,18,0,0">
                <Rectangle HorizontalAlignment="Left" VerticalAlignment="Top" Width="12" Height="12" Fill="Transparent"/>
                <Rectangle HorizontalAlignment="Left" VerticalAlignment="Top" Width="12" Height="12" Fill="White" MouseEnter="ColorRect_MouseEnter" MouseLeave="ColorRect_MouseLeave" MouseLeftButtonUp="ColorRect_MouseLeftButtonUp"/>
                <Rectangle HorizontalAlignment="Left" VerticalAlignment="Top" Width="12" Height="12" Fill="WhiteSmoke" MouseEnter="ColorRect_MouseEnter" MouseLeave="ColorRect_MouseLeave" MouseLeftButtonUp="ColorRect_MouseLeftButtonUp"/>
                <Rectangle HorizontalAlignment="Left" VerticalAlignment="Top" Width="12" Height="12" Fill="Black" MouseEnter="ColorRect_MouseEnter" MouseLeave="ColorRect_MouseLeave" MouseLeftButtonUp="ColorRect_MouseLeftButtonUp"/>
                <Rectangle HorizontalAlignment="Left" VerticalAlignment="Top" Width="12" Height="12" Fill="Black" MouseEnter="ColorRect_MouseEnter" MouseLeave="ColorRect_MouseLeave" MouseLeftButtonUp="ColorRect_MouseLeftButtonUp"/>
                <Rectangle HorizontalAlignment="Left" VerticalAlignment="Top" Width="12" Height="12" Fill="YellowGreen" MouseEnter="ColorRect_MouseEnter" MouseLeave="ColorRect_MouseLeave" MouseLeftButtonUp="ColorRect_MouseLeftButtonUp"/>
                <Rectangle HorizontalAlignment="Left" VerticalAlignment="Top" Width="12" Height="12" Fill="LightSalmon" MouseEnter="ColorRect_MouseEnter" MouseLeave="ColorRect_MouseLeave" MouseLeftButtonUp="ColorRect_MouseLeftButtonUp"/>
                <Rectangle HorizontalAlignment="Left" VerticalAlignment="Top" Width="12" Height="12" Fill="Black" MouseEnter="ColorRect_MouseEnter" MouseLeave="ColorRect_MouseLeave" MouseLeftButtonUp="ColorRect_MouseLeftButtonUp"/>
            </StackPanel>
            
            <Button Grid.Column="0" Name="btnOK" Height="23" VerticalAlignment="Bottom" Click="btnOK_Click" Margin="2,0,17,2">OK</Button>
        </Grid>
        
    </Grid>
</Window>
